<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta http-equiv="Access-Control-Allow-Origin" content="*"/>
    <title>巡检任务管理制定与分配 > 查看</title>
    <!-- BOOTSTRAP STYLES-->
    <link href="../assets/css/bootstrap.css" rel="stylesheet"/>
    <!-- FONTAWESOME STYLES-->
    <link href="../assets/css/font-awesome.css" rel="stylesheet"/>
    <!--CUSTOM BASIC STYLES-->
    <link href="../assets/css/basic.css" rel="stylesheet"/>
    <!--CUSTOM MAIN STYLES-->
    <link href="../assets/css/custom.css" rel="stylesheet"/>
    <!-- GOOGLE FONTS-->
    <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'/>
    <!--站点图标-->
    <!--    <link rel="shortcut icon" type="image/x-icon" href="imgs/favicon.ico"/>-->
</head>
<body>
<div id="wrapper">
    <div id="page-inner">

        <div class="row">
            <div class="col-md-12 col-sm-12">
                <div class="panel panel-default" style="margin: 0px auto">

                    <div class="panel-heading">
                        巡检任务管理制定与分配 > 查看
                    </div>

                    <div class="panel-body">

                        <div style="border: 1px solid slategray;padding: 20px 10px; margin-bottom: 30px;"
                             class="form-horizontal" role="form">
                            <div class="form-group">
                                <div class="col-md-1">
                                    <label for="inspectionTaskCode">任务编号*</label>
                                    <input type="text" class="form-control" id="inspectionTaskCode" disabled>
                                </div>
                                <div class="col-md-2">
                                    <label for="inspectionTaskName">任务名称*</label>
                                    <input type="text" class="form-control" id="inspectionTaskName" disabled>
                                </div>
                                <div class="col-md-1">
                                    <label for="inspectionTaskCode">巡检线路*</label>
                                    <input type="text" class="form-control" id="lineName" disabled>
                                </div>
                                <div class="col-md-1">
                                    <label for="inspectionTaskCode">起始杆号*</label>
                                    <input type="text" class="form-control" id="startPoleCode" disabled>
                                </div>
                                <div class="col-md-1">
                                    <label for="inspectionTaskCode">终止杆号*</label>
                                    <input type="text" class="form-control" id="endPoleCode" disabled>
                                </div>

                                <div class="col-md-2">
                                    <label for="inspectionTaskCode">下发人*</label>
                                    <input type="text" class="form-control" id="issuedByName" disabled>
                                </div>

                                <div class="col-md-2">
                                    <label for="inspectionTaskCode">下发时间*</label>
                                    <input type="text" class="form-control" id="issuedTime" disabled>
                                </div>
                                <div class="col-md-1">
                                    <label for="inspectionTaskCode">任务状态*</label>
                                    <input type="text" class="form-control" id="taskStatusName" disabled>
                                </div>


                            </div>
                            <div class="form-group">
                                <div class="col-md-2">
                                    <label for="inspectionTaskCode">任务完成时间*</label>
                                    <input type="text" class="form-control" id="finishTime" disabled>
                                </div>
                                <div class="col-md-4">
                                    <label for="inspectionTaskCode">备注信息*</label>
                                    <input type="text" class="form-control" id="common" disabled>
                                </div>
                                <div class="col-md-5">
                                    <label for="inspectionTaskCode">巡检员*</label>
                                    <input type="text" class="form-control" id="issuedByNames" disabled>
                                </div>
                            </div>
                        </div>
                        <div>
                            <div style="width: 20%;height: 585px; border: 1px solid slategray;padding: 20px 6px; float: left;">
                                <div class="table-responsive">
                                    <table class="table table-striped table-bordered table-hover"
                                           style="text-align: center">
                                        <thead>
                                        <tr>
                                            <th>
                                                <input disabled class="btn btn-danger col-md-12" id="linecodename"/>
                                            </th>
                                        </tr>
                                        </thead>
                                        <tbody id="polecodename">

                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <div style="width: 80%; height: 585px; border: 1px solid slategray;padding: 20px 10px;float: left;"
                                 class="form-horizontal" role="form">
                                <div class="form-group">
                                    <div class="col-md-2">
                                        <label for="lineCodeDelic">线路编码*</label>
                                        <input type="text" class="form-control" value="" id="lineCodeDelic"
                                               disabled>
                                    </div>
                                    <div class="col-md-2">
                                        <label for="poleCode">杆塔编码*</label>
                                        <input type="text" class="form-control" id="poleCode" disabled>
                                    </div>

                                </div>
                                <div class="form-group">
                                    <div class="col-md-1">
                                        <label for="isBug">有无故障*</label>
                                        <input type="text" class="form-control" id="isBug" disabled>
                                    </div>
                                    <div class="col-md-1">
                                        <label for="intactRate">完好率*</label>
                                        <input type="text" class="form-control" id="intactRate" disabled>
                                    </div>
                                    <div class="col-md-2">
                                        <label for="bugTypeName">缺陷类型*</label>
                                        <input type="text" class="form-control" id="bugTypeName" disabled>
                                    </div>

                                    <div class="col-md-2">
                                        <label for="bugLevelName">缺陷级别*</label>
                                        <input type="text" class="form-control" id="bugLevelName" disabled>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-md-6">
                                        <label for="bugDesc">缺陷描述*</label>
                                        <input type="text" class="form-control" id="bugDesc" disabled>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-md-2">
                                        <label for="inspectTime">巡检时间*</label>
                                        <input type="text" class="form-control" id="inspectTime" disabled>
                                    </div>

                                    <div class="col-md-4">
                                        <label for="xunjianyuan">巡检员*</label>
                                        <input type="text" class="form-control" id="xunjianyuan" disabled>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-md-2">
                                        <label for="discovererName">缺陷发现人*</label>
                                        <input type="text" class="form-control" id="discovererName" disabled>
                                    </div>
                                    <div class="col-md-2">
                                        <label for="discoverTime">发现时间*</label>
                                        <input type="text" class="form-control" id="discoverTime" disabled>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-md-2">
                                        <label for="issuedByNamea">下发人员*</label>
                                        <input type="text" class="form-control" id="issuedByNamea" disabled>
                                    </div>
                                    <div class="col-md-2">
                                        <label for="issuedTimes">下发时间*</label>
                                        <input type="text" class="form-control" id="issuedTimes" disabled>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>


    </div>
</div>
<script src="../assets/js/jquery.min.js"></script>
<!-- BOOTSTRAP SCRIPTS -->
<script src="../assets/js/bootstrap.min.js"></script>

<script>
    $(function () {
        //初始化页面
        initpage();
        getlineAndPole();
        getInspecDetail(1);

    });

    //初始化页面
    function initpage() {
        var InspecId = sessionStorage.getItem("inspeId");
        var url = "http://localhost:8080/inspectask/" + InspecId;
        $.getJSON(url, null, function (data) {
            var inspection = data.obj;
            var lineName1 = inspection.lineName;
            var inspectionTaskCode1 = inspection.inspectionTaskCode;
            var inspectionTaskName1 = inspection.inspectionTaskName;
            var startPoleCode1 = inspection.startPoleCode;
            var endPoleCode1 = inspection.endPoleCode;
            var issuedByName1 = inspection.issuedByName;
            var issuedTime1 = inspection.issuedTime;
            var taskStatusName1 = inspection.taskStatusName;
            var finishTime1 = inspection.finishTime;
            var common1 = inspection.common;
            var xunjianyuan = localStorage.getItem(inspectionTaskCode1);
            //设置表单域的值
            $("#inspectionTaskCode").val(inspectionTaskCode1);
            $("#inspectionTaskName").val(inspectionTaskName1);
            $("#startPoleCode").val(startPoleCode1);
            $("#endPoleCode").val(endPoleCode1);
            $("#issuedByName").val(issuedByName1);
            $("#issuedTime").val(issuedTime1);
            $("#taskStatusName").val(taskStatusName1);
            $("#finishTime").val(finishTime1);
            $("#common").val(common1);
            $("#issuedByNames").val(xunjianyuan);
            $("#lineName").val(lineName1);
        })
    }

    //获取线路以及该线路下的所有塔
    function getlineAndPole() {
        var lineCode = sessionStorage.getItem("lineCodes");
        $.ajax({
            url: "http://localhost:8080/inspectaskdetail/" + lineCode,
            type: 'GET',
            dataType: "json",
            contentType: "application/json;charset=UTF-8",
            success: function (data) {

                var list = data.obj;
                for (var i = 0; i < list.length; i++) {
                    var lineCode = list[i].lineCode;
                    var lineName = list[i].lineName;
                    var poleCode = list[i].poleCode;
                    var poleId = list[i].poleId;
                    var taskId = list[i].taskId;

                    $("#linecodename").val(lineName);
                    var tr = "<tr>" +
                        "<td >" +
                        "<a  class='btn btn-success' href='javascript:getInspecDetail(" + taskId + ")'>" + poleCode + "</a>" +
                        "</td>" +
                        "</tr>"
                    $("#polecodename").append(tr);
                }
            }
        })
    }


    function getInspecDetail(taskId) {
        var url = "http://localhost:8080/inspectaskdetail/getInspecBytaskId/" + taskId;
        $.ajax({
            url: url,
            type: 'GET',
            dataType: "json",
            contentType: "application/json;charset=UTF-8",
            success: function (data) {
                var list = data.obj;
                var bugDesc = list.bugDesc;//  bugDesc: "错误描述"
                var bugLevel = list.bugLevel;
                var bugLevelName = list.bugLevelName;//: " 一般"
                var bugType = list.bugType;
                var bugTypeName = list.bugTypeName;
                var createdBy = list.createdBy;
                var creationTime = list.creationTime;
                var discoverTime = list.discoverTime;
                var discovererCode = list.discovererCode;
                var discovererName = list.discovererName;
                var id = list.id;
                var inspectTime = list.inspectTime;
                var intactRate = list.intactRate;
                var isBug = list.isBug;
                var isSolve = list.isSolve;
                var lastUpdateTime = list.lastUpdateTime;
                var lineCode = list.lineCode;
                var lineName = list.lineName;
                var poleCode = list.poleCode;
                var poleId = list.poleId;
                var taskId = list.taskId;
                var xunjianyuan = $("#issuedByNames").val();
                var xiafaren = $("#issuedByName").val();
                var xiafashijian = $("#issuedTime").val();
                if (isBug == 1) {
                    isBug = '有'
                } else if (isBug == 0) {
                    isBug = '无'
                }
                if (inspectTime == null) {
                    inspectTime = '尚未巡检'
                }
                $("#lineCodeDelic").val(lineCode);
                $("#poleCode").val(poleCode);
                $("#isBug").val(isBug);
                $("#intactRate").val(intactRate + '%');
                $("#bugTypeName").val(bugTypeName);
                $("#bugLevelName").val(bugLevelName);
                $("#bugDesc").val(bugDesc);
                $("#inspectTime").val(inspectTime);
                $("#xunjianyuan").val(xunjianyuan);
                $("#discovererName").val(discovererName);
                $("#discoverTime").val(discoverTime);
                $("#issuedByNamea").val(xiafaren);
                $("#issuedTimes").val(xiafashijian);
            },
            error: function () {

            }

        })


    }
</script>


</body>

</html>